home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / program / fixtree3.arc / FXTRTST.C < prev    next >
C/C++ Source or Header  |  1988-01-24  |  5KB  |  137 lines

  1. /*********************************************************************/
  2. /*      Fixtree Test Routine                                         */
  3. /*      by Guy L. Albertelli    07/30/87                             */
  4. /*           ********** SHAREWARE ************                       */
  5. /*                                                                   */
  6. /*      This routine will cycle through each tree defined in your    */
  7. /*      resource file. Obviously if a tree has no object marked      */
  8. /*      EXIT then there is no way to give the program control back   */
  9. /*********************************************************************/
  10.  
  11. /* original include files
  12. #include "portab.h"
  13. #include "obdefs.h"
  14. #include "define.h"
  15. #include "gemdefs.h"
  16. #include "osbind.h"
  17.  
  18. #include <sample.h>
  19. #include <sample.rsh>
  20. */
  21. /*********************************************************************/
  22. /* INCLUDE FILES                                                     */
  23. /*********************************************************************/
  24.  
  25. #include <obdefs.h>
  26. #include <gemdefs.h>
  27. #include <osbind.h>
  28. #include <portab.h>
  29. /*********************************************************************/
  30. /* RESOURCE DATA                                                     */
  31. /*********************************************************************/
  32.  
  33. #include "sample.h"
  34. #include "sample.c"
  35. /****************************************************************/
  36. /* Note from Lung:                                              */
  37. /*      My RCS can generate .C code but no .RSH code. The file  */
  38. /*      SAMPLE.RSH seems not correct anyway. I use RCS to       */
  39. /*      regeneate .C file and recompile FIXTRTST.C. It runs     */
  40. /*      flawlessly now.                                         */
  41. /****************************************************************/
  42.  
  43.  
  44. /*********************************************************************/
  45. /* EXTERNALS                                                         */
  46. /*********************************************************************/
  47.  
  48. extern  int     gl_apid;
  49.  
  50. /*********************************************************************/
  51. /* GLOBAL VARIABLES                                                  */
  52. /*********************************************************************/
  53.  
  54. int     gl_hchar;
  55. int     gl_wchar;
  56. int     gl_wbox;
  57. int     gl_hbox;        /* system sizes */
  58.  
  59. int     phys_handle;    /* physical workstation handle */
  60. int     handle;         /* virtual workstation handle */
  61.  
  62. int     xdesk,ydesk,hdesk,wdesk;
  63.  
  64. int     contrl[12];
  65. int     intin[128];
  66. int     ptsin[128];
  67. int     intout[128];
  68. int     ptsout[128];    /* storage wasted for idiotic bindings */
  69.  
  70. int work_in[11];        /* Input to GSX parameter array */
  71. int work_out[57];       /* Output from GSX parameter array */
  72. int pxyarray[10];       /* input point array */
  73.  
  74. /****************************************************************/
  75. /* open virtual workstation                                     */
  76. /****************************************************************/
  77. open_vwork()
  78. {
  79. int i;
  80.         for(i=0;i<10;work_in[i++]=1);
  81.         work_in[10]=2;
  82.         handle=phys_handle;
  83.         v_opnvwk(work_in,&handle,work_out);
  84. }
  85.  
  86. /****************************************************************/
  87. /*              Accessory Init. Until First Event_Multi         */
  88. /****************************************************************/
  89. disp_diag(tr,x,y,w,h,obj)
  90. WORD x,y,w,h,obj;
  91. LONG tr;
  92. {
  93.         WORD xd,yd,wd,hd,ex;
  94.         form_center(tr,&xd,&yd,&wd,&hd);
  95.  
  96.         x=y=w=h=0;      /* initialize them to 0 to get better zooming effect
  97.                            Jinfu Chen   Jan 23, 1988 */
  98.  
  99.         form_dial(0,x,y,w,h,xd,yd,wd,hd);
  100.         form_dial(1,x,y,w,h,xd,yd,wd,hd);
  101.         objc_draw(tr,0,MAX_DEPTH,xd,yd,wd,hd);
  102.         ex = form_do(tr,obj);
  103.         form_dial(2,x,y,w,h,xd,yd,wd,hd);
  104.         form_dial(3,x,y,w,h,xd,yd,wd,hd);
  105.         evnt_timer(0,0);
  106.         return ex;
  107. }
  108.  
  109. /****************************************************************/
  110. /*              Accessory Init. Until First Event_Multi         */
  111. /****************************************************************/
  112. main()
  113. {
  114.         LONG tree;
  115.         WORD i;
  116.  
  117.         appl_init();
  118.         phys_handle=graf_handle(&gl_wchar,&gl_hchar,&gl_wbox,&gl_hbox);
  119.         wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
  120.         open_vwork();
  121.         graf_mouse(ARROW,0x0L);
  122.  
  123.         fix_tree(NUM_TREE);
  124.  
  125.         for(i=0;i<NUM_TREE;i++){
  126.                 rsrc_gaddr(R_TREE,i,&tree);
  127.                 disp_diag(tree,xdesk,ydesk,wdesk,hdesk,0);
  128.         }
  129.  
  130.         unfix_tree();
  131.  
  132.         v_clsvwk(handle);
  133.         appl_exit();
  134.  
  135. }
  136.  
  137.